package com.lj.mcore.service;

import com.lj.mcore.domain.IdEntity;
import com.lj.mcore.entity.GoodsStock;
import org.springframework.orm.ObjectOptimisticLockingFailureException;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Retryable;

import java.util.List;
import java.util.Map;

public interface IGoodsStockService {

    public static final String GET_GOOD_STOCK = "from GoodsStock obj where obj.deleteStatus = false and obj.goods.id=:gid";

    public static final String GET_GOOD_STOCK_BY_KEY = "from GoodsStock obj where obj.deleteStatus =:deleteStatus and obj.goods.id=:gid and obj.key =:key";
    public abstract boolean save(GoodsStock obj);

    public GoodsStock getObjById(Long id);

    public abstract GoodsStock getSingleResult(Map<String,Object> map);

    @Retryable(value = ObjectOptimisticLockingFailureException.class,
            backoff = @Backoff(multiplier = 1.5,random = true))
    public Boolean update(GoodsStock obj);

    public List<GoodsStock> query(String paramString, Map paramMap, int paramInt1, int paramInt2);

}
